<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
test(() => assert_selection(
  [
    '<div contenteditable>',
      '^<pre>\n<ul><li>hello</li></ul></pre>|',
    '</div>',
  ].join(''),
  'indent',
  [
    '<div contenteditable>',
      '<pre><ul><ul><li>^hello|</li></ul></ul></pre>',
    '</div>',
  ].join('')), '0 select all children');

test(() => assert_selection(
  [
    '<div contenteditable>',
      '^<pre><ul><li>hello\nworld</li></ul></pre>|',
    '</div>',
  ].join(''),
  'indent',
  [
    '<div contenteditable>',
      '<pre><ul><ul><li>^hello\nworld|</li></ul></ul></pre>',
    '</div>',
  ].join('')), '1 select all children with newline');

test(() => assert_selection(
  [
    '<div contenteditable>',
      '^<ul><li><pre>\nhello\nworld\nblink\n</pre></li></ul>|',
    '</div>',
  ].join(''),
  'indent',
  [
    '<div contenteditable>',
      '<ul><li><pre>',
        '<blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;">',
          '^hello<br>world<br>blink|',
        '</blockquote>',
      '</pre></li></ul>',
    '</div>',
  ].join('')), '2 select all children with newlines');

test(() => assert_selection(
  [
    '<div contenteditable>',
      '<ul><li><pre>\n^hello|\nworld\nblink\n</pre></li></ul>',
    '</div>',
  ].join(''),
  'indent',
  [
    '<div contenteditable>',
      '<ul><li><pre>',
        '<blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;">',
          '^hello|',
         '</blockquote>world\nblink\n',
        '</pre></li></ul>',
    '</div>',
  ].join('')), '3 select line 1');

test(() => assert_selection(
  [
    '<div contenteditable>',
      '<ul><li><pre>\nhello\n^world|\nblink\n</pre></li></ul>',
    '</div>',
  ].join(''),
  'indent',
  [
    '<div contenteditable>',
      '<ul><li><pre>hello\n',
        '<blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;">',
          '^world|</blockquote>blink\n',
      '</pre></li></ul>',
    '</div>',
  ].join('')), '4 select line 2');

test(() => assert_selection(
  [
    '<div contenteditable>',
      '<ul><li><pre>\nhello\nworld\n^blin|k\n</pre></li></ul>',
    '</div>',
  ].join(''),
  'indent',
  [
    '<div contenteditable>',
      '<ul><li><pre>hello\nworld\n',
        '<blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;">',
          '^blin|k',
        '</blockquote>',
      '</pre></li></ul>',
    '</div>',
  ].join('')), '5 select line 3');
</script>
